<?php
// +----------------------------------------------------------------------
// | quanli team
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.fistforward.com/ All rights reserved.
// +----------------------------------------------------------------------
// | Author: create by allen.qiang
// +----------------------------------------------------------------------


/**
 * 基础选项管理功能
 * @package  htdocs
 * @subpackage  quanliadmin
 * @author   create by allen.qiang
 */
quanli_require('module/base/system/sysItemMultilevel.class.php');
class pa_baseItem {

    public function execute() {

        if (isset($_REQUEST['operFlg']) && is_numeric($_REQUEST['operFlg']) && $_REQUEST['operFlg'] > 0) {

            switch ($_REQUEST['operFlg']){
                case 1: //基础选项管理列表
                    $this->baseItemList();
                    break;
                default:
                    $this->toError('参数错误');
                    break;
            }

        } else {

            $this->toError('参数错误');

        }

    }

    /**
     * 转跳到错误页面
     * @param string $msg 错误信息
     */
    private function toError( $msg = '' ) {

        global $G_PGLOB;

        $G_PGLOB->display_error_page( $msg );

    }

    /**
     * 基础选项管理列表
     */
    private function baseItemList(){

        global $G_PGLOB;

        $sysItemMultilevel = new sysItemMultilevel($G_PGLOB->DBCA);

        $arg_array = array(
            'parent_id' => 0,
            'sortname' => 'sort_order',
            'sortorder' => 'ASC'
        );

        $edit_permission = $G_PGLOB->has_permission(30);

        $itemMultiLevelList = $sysItemMultilevel->getItemMultilevelList($arg_array);

        $G_PGLOB->smarty->assign('edit_permission',$edit_permission);

        $G_PGLOB->smarty->assign_by_ref('itemMultiLevelList',$itemMultiLevelList);

        $G_PGLOB->smarty->display('system/baseItemList.tpl');

    }

}